home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / TXT / HierMenu.cpt / HierMenu ƒ / HierMenus.r < prev    next >
Text File  |  1987-05-04  |  3KB  |  112 lines

  1. /*
  2.  * PopUp Menu Example - Resources
  3.  * Bryan Stearns 05May87 
  4.  */
  5.  
  6. /* These define's are handy for disabling specific items in MENUs */
  7. #define AllItems    0b1111111111111111111111111111111    /* 31 flags */
  8. #define MenuItem1    0b000000001
  9. #define MenuItem2    0b000000010
  10. #define MenuItem3    0b000000100
  11. #define MenuItem4    0b000001000
  12. #define MenuItem5    0b000010000
  13. #define MenuItem6    0b000100000
  14. #define MenuItem7    0b001000000
  15. #define MenuItem8    0b010000000
  16. #define MenuItem9    0b100000000
  17.  
  18.  
  19. /* The File menu (it goes in the menu bar) */
  20. resource 'MENU' (128,"amenu") {
  21.     128, textMenuProc,
  22.     AllItems & ~ MenuItem4, /* all on except the ---- */
  23.     enabled, "A Menu",
  24.     {
  25.         "Font",        noicon, "\$1B", "\0D129", plain; /* "\$1B" means "hierarchical"; */
  26.         "Style",    noicon, "\$1B", "\0D130", plain; /* "\0Dxxx" is the menu ID of the submenu. */
  27.         "Size",        noicon, "\$1B", "\0D131", plain;
  28.         "-",            noicon, nokey, nomark, plain;
  29.         "Quit",        noicon, "Q", noMark, plain
  30.     }
  31. };
  32.  
  33. /* the Font submenu */
  34. resource 'MENU' (129,"Font",preload) {
  35.     129, textMenuProc,
  36.     AllItems,
  37.     enabled, "Font",
  38.     {
  39.         /* font names will be inserted with AddResMenu at runtime */
  40.     }
  41. };
  42.  
  43. /* the Style submenu */
  44. resource 'MENU' (130,"Style",preload) {
  45.     130, textMenuProc,
  46.     AllItems,
  47.     enabled, "Style",
  48.     {
  49.         "Plain",                    noicon, "P", noMark, plain;
  50.         "Bold",                        noicon, "B", noMark, $01;
  51.         "Italic",                    noicon, "I", noMark, $02;
  52.         "Underline",            noicon, "U", noMark, $04;
  53.         "Outline",                noicon, noKey, noMark, $08;
  54.         "Shadow",                    noicon, noKey, noMark, $10
  55.     }
  56. };
  57.  
  58. /* the Size submenu */
  59. resource 'MENU' (131,"Size",preload) {
  60.     131, textMenuProc,
  61.     AllItems,
  62.     enabled, "Size",
  63.     {
  64.         "9",                            noicon, noKey, noMark, plain;
  65.         "10",                            noicon, noKey, noMark, plain;
  66.         "12",                            noicon, noKey, noMark, plain;
  67.         "14",                            noicon, noKey, noMark, plain;
  68.         "18",                            noicon, noKey, noMark, plain;
  69.         "24",                            noicon, noKey, noMark, plain
  70.     }
  71. };
  72.  
  73.  
  74. /* Our window */
  75. resource 'WIND' (128) {
  76.     {50, 50, 280, 462}, documentProc, visible, noGoAway, 0, "Hierarchical Menus Test"
  77. };
  78.  
  79. /* Strings to draw */
  80. resource 'STR#' (128) {
  81.     {
  82.         "Hierarchical Menu Example";
  83.         "Apple Developer Technical Support";
  84.         "(BJS) 07May87";
  85.         "Try the menus!"
  86.     }
  87. };
  88.  
  89. /* The “I need System 4.1 etc.” alert */
  90. resource 'ALRT' (128) {
  91.     {50, 50, 180, 370}, 128, {
  92.         OK, visible, sound1;
  93.         OK, visible, sound1;
  94.         OK, visible, sound1;
  95.         OK, visible, sound1
  96.     }
  97. };
  98.  
  99. /* The item list for our “I need System 4.1 etc.” alert */
  100. resource 'DITL' (128) {
  101.     {    
  102.         /* the “OK” button */
  103.         {100, 220, 120, 300}, Button { enabled, "Finder" },
  104.         
  105.         /* The message */
  106.         {10, 65, 90, 300}, StaticText { disabled,
  107.             "The Hierarchical Menu Example requires a Macintosh II, SE, Plus, or "
  108.             "512Ke personal computer, with system software version 4.1 or newer."
  109.         }
  110.     }
  111. };
  112.